<template >
  <div>
    <div style="text-align: right">
      <el-input placeholder="请输入内容" v-model="condition.gjc.value" style="width: 30%; margin-bottom: 15px">
        <template slot="append">
          <el-button type="primary" @click="() => $refs.table.searchForm()">查询</el-button>
        </template>
      </el-input>
    </div>
    <comm-table
      ref="table"
      :columns="columns"
      :condition="condition"
      url="/v1/subject/search"
      @select="onSelectionChange"
      @selectAll="(rows) => onSelectAll(rows, $refs.table.$refs.table.renderData)"
      @changeData="(val) => handleSelect(val)"
    />
    <div v-footer>
      <el-button type="primary" @click="onRelate" :loading="loading">关联</el-button>
      <el-button @click="() => $emit('close')">关闭</el-button>
    </div>
  </div>
</template>
<script>
import tableSelect from '@/mixin/tableSelect';
export default {
  name: 'SpecialModal',
  mixins: [tableSelect],
  props: {
    id: {
      type: String
    }
  },
  data() {
    return {
      loading: false,
      columns: [
        { label: '', type: 'selection', renderSelectable: (row) => row.isgl === '0' },
        { label: '序号', type: 'index', width: 70 },
        { label: '创建时间', prop: 'createTime', width: 200 },
        //{ label: '信息编号', prop: 'serialNo' },  //专题没有信息编号
        { label: '标题', prop: 'title' },
        { label: '创建单位', prop: 'createOrgName' }
      ],
      condition: {
        gjc: {
          value: '',
          op: 'like'
        },
        isRelease: { //查询专题时，需要查询已经发布的专题
          value: '1',
          op: 'eq'
        },
        flowId: {
          value: this.id,
          op: 'eq'
        }
      }
    };
  },
  methods: {
    /**
     * 关联
     */
    onRelate() {
      this.$emit('onRelate', this.multipleSelection);
      this.$emit('close');
    }
  }
};
</script>
